package com.tg.app.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.demo.view.SettingItemTextView;
import com.tg.app.R;
import com.tg.data.http.entity.SmartSpeakerBean;

import java.util.ArrayList;

public class SmartSpeakerAdapter extends BaseAdapter {
    private ArrayList<SmartSpeakerBean> list;

    private Context context;

    public SmartSpeakerAdapter(ArrayList<SmartSpeakerBean> list, Context context){
        this.list = list;
        this.context = context;
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }



    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView == null){
            convertView = LayoutInflater.from(context).inflate(R.layout.layout_lockbell_user, null);
        }
        SettingItemTextView settingItemTextView = (SettingItemTextView)convertView;
        SmartSpeakerBean data = list.get(position);
        settingItemTextView.setName(data.getName());
        return convertView;
    }
}
